home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1992 June: ROMin Holiday / ADC Developer CD (1992-06) (''ROMin Holiday'')_iso / Developer Connection - 06-1992.iso / Periodicals / develop / develop 3 code / Surf's Up! / Interfaces / PInterfaces / CMIntf.p next >
Encoding:
Text File  |  1989-11-17  |  6.6 KB  |  251 lines  |  [TEXT/MPS ]

  1. {
  2.     CMIntf.p
  3.     Pascal Interface to the Connection Manager
  4.     
  5.     Copyright © Apple Computer, Inc. 1988,1989
  6.     All rights reserved
  7. }
  8. {$IFC UNDEFINED UsingIncludes}
  9. {$SETC UsingIncludes := 0}
  10. {$ENDC}
  11.  
  12. {$IFC NOT UsingIncludes}
  13.     UNIT CMIntf;
  14.     INTERFACE
  15. {$ENDC}
  16.  
  17. {$IFC UNDEFINED UsingCMIntf}
  18. {$SETC UsingCMIntf := 1}
  19.  
  20. {$I+}
  21. {$SETC CMIntfIncludes := UsingIncludes}
  22. {$SETC UsingIncludes := 1}
  23. {$IFC UNDEFINED UsingDialogs}
  24. {$I Dialogs.p}
  25. {$ENDC}
  26.  
  27. {$IFC UNDEFINED UsingCTBUtils}
  28. {$I CTBUtils.p}
  29. {$ENDC}
  30.  
  31. {$SETC UsingIncludes := CMIntfIncludes}
  32.  
  33. CONST
  34. { current Connection Manager version }
  35.     curCMVersion        =    1;
  36.  
  37. { current Connection Manager Environment Record version }
  38.     curConnEnvRecVers    =    0;
  39.     
  40. { error codes }
  41.     cmGenericError        =    -1;
  42.     cmNoErr                =    0;
  43.     cmRejected             =    1;
  44.     cmFailed            =    2;
  45.     cmTimeOut            =    3;
  46.     cmNotOpen            =    4;
  47.     cmNotClosed            =    5;
  48.     cmNoRequestPending    =    6;
  49.     cmNotSupported        =    7;
  50.     cmNoTools            =    8;
  51.  
  52. { CMRecFlags / CMChannel}
  53. {    Low word of CMRecFlags is same as CMChannel }
  54.     cmData                =     $00000001;
  55.     cmCntl                =     $00000002;
  56.     cmAttn                =     $00000004;
  57.  
  58.     cmDataClean            =     $00000100;  
  59.     cmCntlClean            =     $00000200;
  60.     cmAttnClean            =     $00000400;
  61.  
  62.                                         {    only for CMRecFlags (not CMChannel) below this point }
  63.     cmNoMenus            =     $00010000;
  64.     cmQuiet                =     $00020000;
  65.  
  66. { CMStatFlags}
  67.     cmStatusOpening        =     $00000001;
  68.     cmStatusOpen        =     $00000002;
  69.     cmStatusClosing        =     $00000004;
  70.     cmStatusDataAvail    =     $00000008;
  71.     cmStatusCntlAvail    =     $00000010;
  72.     cmStatusAttnAvail    =     $00000020;
  73.  
  74.     cmStatusDRPend        =     $00000040;        {data read pending}
  75.     cmStatusDWPend        =     $00000080;        {data write pending}
  76.     cmStatusCRPend        =     $00000100;        {cntl read pending}
  77.     cmStatusCWPend        =     $00000200;        {cntl write pending}
  78.     cmStatusARPend        =     $00000400;        {attn read pending}
  79.     cmStatusAWPend        =     $00000800;        {attn write pending}
  80.  
  81.     cmStatusBreakPend     =    $00001000;
  82.     cmStatusListenPend     =     $00002000;
  83.     cmStatusIncomingCallPresent    
  84.                         =    $00004000;
  85.  
  86. { CMSearchFlags}
  87.     cmSearchSevenBit    =     $0001;
  88.     
  89. { CMFlags}
  90.     cmFlagsEOM            =     $0001;
  91.     
  92. TYPE
  93.     CMErr                =    OSErr;
  94.     
  95.     CMBufFields = (
  96.         cmDataIn,
  97.         cmDataOut,
  98.     
  99.         cmCntlIn,
  100.         cmCntlOut,
  101.     
  102.         cmAttnIn,
  103.         cmAttnOut,
  104.         
  105.         cmRsrvIn,
  106.         cmRsrvOut
  107.     );
  108.     
  109.     CMBuffers        =    ARRAY[CMBufFields] OF Ptr;
  110.     CMBufferSizes    =    ARRAY[CMBufFields] OF LONGINT;
  111.     
  112.     CMStatFlags     =     LONGINT;
  113.     CMRecFlags         =     LONGINT;
  114.     CMChannel         =     INTEGER;
  115.     CMSearchFlags     =     INTEGER;
  116.     CMFlags         =     INTEGER;
  117.  
  118.     ConnEnvironRecPtr 
  119.                     =     ^ConnEnvironRec;
  120.     ConnEnvironRec     =    RECORD
  121.         version            :    INTEGER;
  122.         baudRate        :    LONGINT;
  123.         dataBits        :    INTEGER;
  124.         channels        :    CMChannel;
  125.         swFlowControl    :    BOOLEAN;
  126.         hwFlowControl    :    BOOLEAN;
  127.         flags            :    CMFlags;
  128.     END;
  129.     
  130.     ConnHandle        =    ^ConnPtr;
  131.     ConnPtr            =    ^ConnRecord;
  132.     ConnRecord        =    RECORD
  133.         procID        :    INTEGER;
  134.         
  135.         flags        :    CMRecFlags;
  136.         errCode        :    CMErr;
  137.         
  138.         refCon        :    LONGINT;
  139.         userData    :    LONGINT;
  140.  
  141.         defProc        :    ProcPtr;
  142.  
  143.         config        :    Ptr;
  144.         oldConfig    :    Ptr;
  145.  
  146.         reserved0    :    LONGINT;
  147.         reserved1    :    LONGINT;
  148.         reserved2    :    LONGINT;
  149.  
  150.         cmPrivate    :    Ptr;
  151.         
  152.         bufferArray    :    CMBuffers;
  153.         bufSizes    :    CMBufferSizes;
  154.                 
  155.         mluField    :    LONGINT;
  156.         
  157.         asyncCount     :    CMBufferSizes;
  158.     END;
  159.     
  160.     
  161.  
  162. FUNCTION     InitCM: CMErr;
  163. FUNCTION     CMGetVersion(hConn: ConnHandle): Handle;
  164. FUNCTION     CMGetCMVersion: INTEGER;
  165.  
  166. FUNCTION      CMNew(procID: INTEGER; flags: CMRecFlags; 
  167.                     desiredSizes: CMBufferSizes; refCon: LONGINT; 
  168.                     userData: LONGINT): ConnHandle;
  169. PROCEDURE     CMDispose(hConn: ConnHandle);
  170.  
  171. FUNCTION     CMListen(hConn: ConnHandle; async: BOOLEAN; completor: ProcPTr; 
  172.                     timeout: LONGINT): CMErr;
  173. FUNCTION     CMAccept(hConn: ConnHandle; accept: BOOLEAN): CMErr;
  174.  
  175. FUNCTION     CMOpen(hConn: ConnHandle; async: BOOLEAN; completor: ProcPtr; 
  176.                     timeout: LONGINT): CMErr;
  177. FUNCTION     CMClose(hConn: ConnHandle; async: BOOLEAN; completor: ProcPtr; 
  178.                     timeout: LONGINT; now: BOOLEAN): CMErr;
  179.  
  180. FUNCTION     CMAbort(hConn: ConnHandle): CMErr;
  181.  
  182. FUNCTION     CMStatus(hConn: ConnHandle; VAR sizes: CMBufferSizes; 
  183.                     VAR flags: CMStatFlags): CMErr;
  184. PROCEDURE     CMIdle(hConn: ConnHandle);
  185.  
  186. PROCEDURE     CMReset(hConn: ConnHandle);
  187.  
  188. PROCEDURE     CMBreak(hConn: ConnHandle; duration: LONGINT; async: BOOLEAN;  
  189.                     completor: ProcPtr);
  190.  
  191. FUNCTION     CMRead(hConn: ConnHandle; theBuffer: Ptr; VAR toRead: LONGINT; 
  192.                     theChannel: CMChannel; async: BOOLEAN;  
  193.                     completor: ProcPtr; timeout: LONGINT; VAR flags: CMFlags): CMErr;
  194. FUNCTION     CMWrite(hConn: ConnHandle; theBuffer: Ptr; VAR toWrite: LONGINT; 
  195.                     theChannel: CMChannel; async: BOOLEAN; 
  196.                     completor: ProcPtr; timeout: LONGINT; flags: CMFlags): CMErr;
  197. FUNCTION     CMIOKill(hConn: ConnHandle; which: INTEGER): CMErr;
  198.  
  199. PROCEDURE     CMActivate(hConn: ConnHandle; activate: BOOLEAN);
  200. PROCEDURE     CMResume(hConn: ConnHandle; resume: BOOLEAN);
  201. FUNCTION     CMMenu(hConn: ConnHandle; menuID: INTEGER; item: INTEGER): BOOLEAN;
  202.  
  203. FUNCTION     CMValidate(hConn: ConnHandle): BOOLEAN;
  204. PROCEDURE     CMDefault(VAR theConfig: Ptr ; procID: INTEGER; allocate: BOOLEAN);
  205.  
  206. FUNCTION     CMSetupPreflight(procID: INTEGER; VAR magicCookie: LONGINT):Handle;
  207. PROCEDURE     CMSetupSetup(procID: INTEGER; theConfig: Ptr; count: INTEGER; theDialog: DialogPtr;
  208.                         VAR magicCookie:LONGINT);
  209. FUNCTION     CMSetupFilter(procID: INTEGER; theConfig: Ptr; count: INTEGER; 
  210.                         theDialog: DialogPtr; VAR theEvent: EventRecord; VAR theItem: INTEGER;
  211.                         VAR magicCookie: LONGINT): BOOLEAN;
  212. PROCEDURE     CMSetupItem(procID: INTEGER; theConfig: Ptr; count: INTEGER; theDialog: DialogPtr;
  213.                         VAR theItem: INTEGER; VAR magicCookie: LONGINT);
  214. PROCEDURE     CMSetupCleanup(procID: INTEGER; theConfig: Ptr; count: INTEGER; theDialog: DialogPtr;
  215.                         VAR magicCookie: LONGINT);
  216. PROCEDURE    CMSetupPostflight(procID: INTEGER);
  217.  
  218. FUNCTION     CMGetConfig(hConn: ConnHandle): Ptr;
  219. FUNCTION     CMSetConfig(hConn: ConnHandle; thePtr: Ptr): INTEGER;
  220.  
  221. FUNCTION     CMIntlToEnglish(hConn: ConnHandle; inputPtr: Ptr; VAR outputPtr: Ptr; 
  222.                     language: INTEGER): OSErr;
  223. FUNCTION     CMEnglishToIntl(hConn: ConnHandle; inputPtr: Ptr; VAR outputPtr: Ptr; 
  224.                     language: INTEGER): OSErr;
  225.  
  226. FUNCTION     CMAddSearch(hConn: ConnHandle; theString: Str255; flags: CMSearchFlags;
  227.                     callBack: ProcPtr): LONGINT;
  228. PROCEDURE     CMRemoveSearch(hConn: ConnHandle; refnum: LONGINT);
  229. PROCEDURE     CMClearSearch(hConn: ConnHandle);
  230.  
  231. FUNCTION     CMGetConnEnvirons(hConn: ConnHandle; VAR theEnvirons: ConnEnvironRec): CMErr;
  232.  
  233. FUNCTION     CMChoose(VAR hConn: ConnHandle; where: Point; idleProc: ProcPtr): INTEGER;
  234. PROCEDURE     CMEvent(hConn: ConnHandle; theEvent: EventRecord);
  235.                     
  236. PROCEDURE     CMGetToolName(procID: INTEGER; VAR name: Str255);
  237. FUNCTION      CMGetProcID(name: Str255): INTEGER;
  238.  
  239. PROCEDURE     CMSetRefCon(hConn: ConnHandle; refCon: LONGINT);
  240. FUNCTION     CMGetRefCon(hConn: ConnHandle): LONGINT;
  241.  
  242. PROCEDURE     CMSetUserData(hConn: ConnHandle; userData: LONGINT);
  243. FUNCTION     CMGetUserData(hConn: ConnHandle): LONGINT;
  244.  
  245. {$ENDC} {UsingCMIntf}
  246.  
  247. {$IFC NOT UsingIncludes}
  248.     END.
  249. {$ENDC}
  250.  
  251.